package org.dtrd.modules.shop.entity.po;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.shop.entity.bean.OrderJoinAddressDetail;

import java.util.Date;


/**
 * <p>
 * 订单与收货地址关联关系
 * </p>
 *
 * @author sun
 * @since 2022-07-28
 */
@Getter
@Setter
@TableName("dtrd_ent_shc_rd_order_join_address")
public class DtrdEntShcRdOrderJoinAddress {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 订单号
     */
    @TableField("order_id")
    private String orderId;

    /**
     * 联系人
     */
    @TableField("contact_person")
    private String contactPerson;

    /**
     * 联系电话
     */
    @TableField("contact_phone")
    private String contactPhone;

    /**
     * 收货地址
     */
    @TableField("contact_address")
    private String contactAddress;

    /**
     * 物流公司
     */
    @TableField("logistics_name")
    private String logisticsName;

    /**
     * 物流单号
     */
    @TableField("logistics_no")
    private String logisticsNo;

    /**
     * 发货时间
     */
    @TableField("logistics_time")
    private Date logisticsTime;

    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntShcRdOrderJoinAddress init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntShcRdOrderJoinAddress parseFromDto(OrderJoinAddressDetail dto) {
        dataId = dto.getDataId();
        orderId = dto.getOrderId();
        contactPerson = dto.getContactPerson();
        contactPhone = dto.getContactPhone();
        contactAddress = dto.getContactAddress();
        logisticsName = dto.getLogisticsName();
        logisticsNo = dto.getLogisticsNo();
        logisticsTime = dto.getLogisticsTime();
        return this;
    }


}
